package com.framework.bdf4j.tool.example;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.framework.bdf4j.sysadm.entity.SysDept;
import com.framework.bdf4j.sysadm.service.SysDeptService;

/**
 * example 组件示例
 * 
 */
@Controller
@RequestMapping("/tool/example")
public class ExampleController {
	private SysDeptService sysDeptService;
	
	@GetMapping()
    public String example() {
        return "tool/example/example";
    }
	
	
	@GetMapping("/selectDeptExa")
    public String selectDeptExa(@RequestParam(required = false) String deptId, ModelMap mmap) {
        SysDept dept = new SysDept();
        if (StringUtils.isNotEmpty(deptId)) {
            dept = sysDeptService.getById(deptId);
        }
        mmap.put("dept", dept);
        return "tool/example/deptTree";
    }
}
